#define _CRT_SECURE_NO_WARNINGS 1


#include <stdio.h>

int ch[50];

int main()
{
	int n = 0;
	scanf("%d", &n);
	int i = 0;
	ch[i++] = n;
	while (n!=1)
	{
		if (n % 2 != 0)
		{
			n = n * 3 + 1;
		}
		else
			n /= 2;
		ch[i++] = n;
	}
	int k = 0;
	for (k = i - 1; k >= 0; k--)
	{
		printf("%d ", ch[k]);
	}
	return 0;
}